package com.kunyi.web.service.log.core.transform;

import com.kunyi.platform.log.entity.dto.SaveSafeDto;
import com.kunyi.web.service.log.entity.domain.LogSafe;
import com.kunyi.web.service.log.entity.resp.LogSafeDetailResp;
import com.kunyi.web.service.log.entity.resp.LogSafeListResp;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @ClassName LogSafeTransform
 * @Description log_safe相关对象转换
 * @Author pengjunjun
 * @Date 2024/3/6 16:16
 * @Version 1.0
 **/
public class LogSafeTransform {

    /**
     * @Author pengjunjun
     * @Description LogSafe -> LogSafeListResp
     * @Date 18:46 2024/3/6
     * @Param logSafe:
     * @return LogSafeListResp
     **/
    public static LogSafeListResp log2ListResp(LogSafe logSafe) {
        return new LogSafeListResp().setId(logSafe.getId().toString())
                .setCode(logSafe.getCode())
                .setCreateUser(logSafe.getCreateUser())
                .setCreateTime(logSafe.getCreateTime())
                .setEnvType(logSafe.getEnvType())
                .setEnvName(logSafe.getEnvName())
                .setStatus(logSafe.getStatus());
    }

    /**
     * @Author pengjunjun
     * @Description LogSafe -> LogSafeDetailResp
     * @Date 18:47 2024/3/6
     * @Param logSafe:
     * @return LogSafeDetailResp
     **/
    public static LogSafeDetailResp log2DetailResp(LogSafe logSafe) {
        return new LogSafeDetailResp()
                .setCode(logSafe.getCode())
                .setCreateUser(logSafe.getCreateUser())
                .setCreateTime(logSafe.getCreateTime())
                .setEnvType(logSafe.getEnvType())
                .setEnvName(logSafe.getEnvName())
                .setEnvDetail(logSafe.getEnvDetail())
                .setStatus(logSafe.getStatus());
    }

    /**
     * @Author pengjunjun
     * @Description SaveSafeDto -> LogSafe
     * @Date 15:57 2024/3/9
     * @Param saveSafe:
     * @return LogSafe
     **/
    public static LogSafe save2Log(SaveSafeDto saveSafe) {
        LogSafe logSafe = new LogSafe();
        logSafe.setCode(saveSafe.getCode());
        logSafe.setEnvType(saveSafe.getEnvType());
        logSafe.setEnvName(saveSafe.getEnvName());
        logSafe.setStatus(saveSafe.getStatus());
        logSafe.setEnvDetail(saveSafe.getEnvDetail());
        return logSafe;
    }
}
